home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Floppyshop 2
/
Floppyshop - 2.zip
/
Floppyshop - 2.iso
/
art&graf.ix
/
art-0039
/
spr_des
/
source
/
spr_des2.a68
< prev
next >
Wrap
Text File
|
1997-04-16
|
27KB
|
972 lines
ORG 0
* Source code to GFA basic, SPRITE DESIGNER
* File: SPR_DES2.A68
* How to use:
* Poke.B start+0,mode 0-19
* Poke.B start+1,x 0-31
* Poke.B start+2,y 0-31
* Poke.B start+3,color 0-15
* Poke.B start+4,x_to 0-31
* Poke.B start+5,y_to 0-31
* Poke.B start+6,img1 0-15 (image to be edit)
* Poke.B start+7,img1 0-15 use when Swap Images&Copy Images
* Poke.W start+8,spritex 0-350
* Poke.W start+10,spritey 0-230
* Poke.L start+14,phys physical screen
* Poke.L start+18,background background screen
* Poke.L start+22,image ptr ptr to 16 images (512*16 bytes)
* Call start+30
* Mode:
* 0: Plot x,y,color
* 1: Line x,y,x_to,y_to,color
* 2: Fill x,y,color
* 3: Rotate Left
* 4: Rotate Right
* 5: Rotate Up
* 6: Rotate Down
* 7: Mirror
* 8: Up&Down
* 9: Turn 90'
* 10: Turn 270'
* 11: Clear
* 12: Copy Phys to Background
* 13: Copy Background to Phys (scr3 to scr1&scr2)
* 14: Show sprite
* 15: Move sprite
* 16: Hide sprite
* 17: Swap Images
* 18: Copy Images
* 19: Put image to board
*
ainit equ $a000
aput equ $a001
aget equ $a002
abox equ $a005
ashow equ $a009
ahide equ $a00a
*
mode equ 0
x1 equ 1
y1 equ 2
color equ 3
x2 equ 4
y2 equ 5
img1 equ 6
img2 equ 7
sprx equ 8
spry equ 10
sprimg equ 12
scr1 equ 14
scr2 equ 18
imgptr equ 22
*
var ds.b 30
*
* start of code...
*
* Initialize & Get address to routine
lea var(pc),a3
dc.w ainit ;init line-a
move.l a0,a4 ;base address
move.l 8(a0),a5 ;intin-arrays
move.l 12(a0),a6 ;ptsin-arrays
dc.w ahide ;hide mouse
clr.w $24(a4) ;writing mode=replace
lea fillpat(pc),a0 ;fill pattern
move.l a0,$2e(a4) ; =solid
move.w #1,$32(a4) ;one pattern mask
clr.w $34(a4) ;one color fill
clr.w $36(a4) ;no clipping
move.b mode(a3),d0
tst.b d0 ;plot?
beq plot
cmp.b #1,d0 ;line?
beq line
cmp.b #2,d0 ;fill?
beq fill
cmp.b #3,d0 ;rotate left?
beq left
cmp.b #4,d0 ;r. right?
beq right
cmp.b #5,d0 ;r. up?
beq up
cmp.b #6,d0 ;r. down?
beq down
cmp.b #7,d0 ;mirror?
beq mirror
cmp.b #8,d0 ;up&down?
beq updown
cmp.b #9,d0 ;turn 90' ?
beq turn90
cmp.b #10,d0 ;turn 270' ?
beq turn270
cmp.b #11,d0 ;clear?
beq clear
cmp.b #12,d0 ;copy phys to background?
beq copy1
cmp.b #13,d0 ;copy background to phys?
beq copy2
cmp.b #14,d0 ;Show sprite?
beq showspr
cmp.b #15,d0 ;Move sprite?
beq movespr
cmp.b #16,d0 ;Hide sprite?
beq hidespr
cmp.b #17,d0 ;swap images?
beq swapimg
cmp.b #18,d0 ;copy images?
beq copyimg
cmp.b #19,d0 ;put image to board?
beq putimg
*
*
exit move #0,0(a5)
dc.w ashow
rts 'return to Basic
*
* used by program
* Get image from board (pos. 256,144)
getimg move #9,d1
move.l imgptr(a3),a0 ;ptr to 16 images
clr d0
move.b img1(a3),d0 ;edit image
lsl d1,d0 ;each image 512 bytes
lea 0(a0,d0.w),a0 ;address to current image
move.l scr1(a3),a1 ;physical screen
add.l #23168,a1 ;pos. 256,144
move #31,d0 ;32 lines
getl move.l (a1)+,(a0)+ ;copy from screen to image
move.l (a1)+,(a0)+
move.l (a1)+,(a0)+
move.l (a1)+,(a0)+
add.l #144,a1 ;next line
dbf d0,getl
rts
* used by program
* Set color ,color in D2
setcolor move.w d2,0(a5)
clr.l $18(a4)
clr.l $1c(a4)
btst #0,d2
beq bp0
move.w #1,$18(a4)
bp0 btst #1,d2
beq bp1
move.w #1,$1a(a4)
bp1 btst #2,d2
beq bp2
move.w #1,$1c(a4)
bp2 btst #3,d2
beq bp3
move.w #1,$1e(a4)
bp3 rts
*
* (used by fill,rotate...)
* Get a Point from screen (looking in small box)
* In: D0=x D1=y Out:D3=color
point movem.l d0/d1/d2,-(a7)
add #256,d0
add #144,d1
move d0,0(a6)
move d1,2(a6)
dc.w aget
move d0,d3
movem.l (a7)+,d0/d1/d2
rts
*
* Plot a point: Big Point & Small Point
plot clr.w d0
clr.w d1
move.b x1(a3),d0
move.b y1(a3),d1
move.b color(a3),d2
bsr setcolor
bsr plot0
bsr getimg ;new image
bra exit
*
* Plot0 (used by plot,line,fill...)
* d0=x,d1=y (color is set!)
plot0 movem.l d0/d1/d2/d3/d4,-(a7)
*plot on small board
move.w d0,d3 ;save x&y
move.w d1,d4
add.w #256,d0
add.w #144,d1
move.w d0,0(a6)
move.w d1,2(a6)
dc.w aput ;plot x+256,y+144
*plot on big board box 6x+1,6y+1,6x+5,6y+5
mulu #6,d3
mulu #6,d4
addq.w #1,d3
addq.w #1,d4
move.w d3,$26(a4) ;6*x+1
move.w d4,$28(a4) ;6*y+1
addq.w #4,d3
addq.w #4,d4
move.w d3,$2a(a4) ;6*x+5
move.w d4,$2c(a4) ;6*y+5
dc.w abox ;filled rectangle
movem.l (a7)+,d0/d1/d2/d3/d4
rts
*
* Line
*
line move.b color(a3),d2
bsr setcolor
lea local(pc),a0
clr.l d0
clr.l d1
clr.l d2
clr.l d3
move.b x1(a3),d0 ;x1
move.b y1(a3),d1 ;y1
move.b x2(a3),d2 ;x2
move.b y2(a3),d3 ;y2
move d2,d7
sub d0,d7
move d7,dx(a0) ;dx=x2-x1
move #1,sdx(a0) ;count sgn(dx) & abs(dx)...
tst d7
bpl dxplus
neg d7
move #$ffff,sdx(a0)
dxplus move d7,adx(a0)
move d3,d7
sub d1,d7
move d7,dy(a0) ;dy=y2-y1
move #1,sdy(a0) ;count sgn(dy) & abs(dy)...
tst d7
bpl dyplus
neg d7
move #$ffff,sdy(a0)
dyplus move d7,ady(a0)
cmp adx(a0),d7 ;abs(dx)=abs(dy)?
bne dynodx ;no
move sdx(a0),d2 ;xstep= -1,0 or +1
swap d2
move sdy(a0),d3 ;ystep= -1,0 or +1
swap d3
bra draw
dynodx bge dybigdx ;abs(dy)>=abs(dx)?
move adx(a0),d7
move sdx(a0),d2 ;xstep= -1,0 or +1
swap d2
move ady(a0),d3
swap d3
divu d7,d3 ;ystep= abs(dy)/abs(dx) ( *sgn(dy) )
and.l #$ffff,d3
tst sdy(a0)
bpl draw
neg.l d3
bra draw
dybigdx move ady(a0),d7
move sdy(a0),d3 ;ystep= -1,0 or +1
swap d3
move adx(a0),d2 ;xstep= abs(dx)/abs(dy) ( *sgn(dx) )
swap d2
divu d7,d2
and.l #$ffff,d2
tst sdx(a0)
bpl draw
neg.l d2
draw swap d0
swap d1
move #$8000,d0
move #$8000,d1
swap d0
swap d1
lloop bsr plot0
swap d0
swap d1
add.l d2,d0
add.l d3,d1
swap d0
swap d1
dbf d7,lloop
bsr getimg ;update image
bra exit
*
* Fill
fill move.b color(a3),d2
clr d0
clr d1
move.b x1(a3),d0
move.b y1(a3),d1
bsr setcolor
bsr point ;color at x,y in D3
move d3,d4
cmp.b d2,d4 ;fill color=background color?
beq fillend
bsr fill0
fillend bsr getimg ;update image
bra exit
fill0 bsr point
cmp.b d3,d4 ;another color than background?
bne noysub ;yes (exit)
bsr plot0
cmp #30,d0 ;x>30?
bhi noxadd ;yes
addq #1,d0 ;try fill x+1,y
bsr fill0
subq #1,d0
noxadd cmp #30,d1 ;y>30?
bhi noyadd ;yes
addq #1,d1 ;try fill x,y+1
bsr fill0
subq #1,d1
noyadd tst d0 ;x=0?
beq noxsub ;yes
subq #1,d0 ;try fill x-1,y
bsr fill0
addq #1,d0
noxsub tst d1 ;y=1?
beq noysub ;yes
subq #1,d1 ;try fill x,y-1
bsr fill0
addq #1,d1
noysub rts
*
* Rotate Left
left move #31,d1 ;y=31 to 0
rotly clr d0 ;x=0 to 30
rotlx addq #1,d0 ;get color from x+1,y
bsr point
subq #1,d0
move d3,d2 ;and plot it at x,y
bsr setcolor
bsr plot0
addq #1,d0
cmp #31,d0
bne rotlx ;next x
clr d2
bsr setcolor
bsr plot0 ;rotate in color 0
dbf d1,rotly ;next y
bsr getimg ;update image
bra exit
*
* Rotate Right
right move #31,d1 ;y=31 to 0
rotry move #31,d0 ;x=31 to 1
rotrx subq #1,d0 ;get color from x-1,y
bsr point
addq #1,d0
move d3,d2 ;and plot it at x,y
bsr setcolor
bsr plot0
subq #1,d0
tst d0
bne rotrx ;next x
clr d2
bsr setcolor
bsr plot0 ;rotate in color 0
dbf d1,rotry ;next y
bsr getimg ;update image
bra exit
*
* Rotate Up
up move #31,d0 ;x=31 to 0
rotux clr d1 ;y=0 to 30
rotuy addq #1,d1 ;get color from x,y+1
bsr point
subq #1,d1
move d3,d2 ;and plot it at x,y
bsr setcolor
bsr plot0
addq #1,d1
cmp #31,d1
bne rotuy ;next y
clr d2
bsr setcolor
bsr plot0 ;rotate in color 0
dbf d0,rotux ;next x
bsr getimg ;update image
bra exit
*
* Rotate Down
down move #31,d0 ;x=31 to 0
rotdx move #31,d1 ;y=31 to 1
rotdy subq #1,d1 ;get color from x,y-1
bsr point
addq #1,d1
move d3,d2 ;and plot it at x,y
bsr setcolor
bsr plot0
subq #1,d1
tst d1
bne rotdy ;next y
clr d2
bsr setcolor
bsr plot0 ;rotate in color 0
dbf d0,rotdx ;next x
bsr getimg ;update image
bra exit
*
* Mirror
mirror move #31,d1 ;y=31 to 0
miry move #15,d0 ;x=15 to 0
mirx bsr point ;color at x,y
move d3,d4
eor #31,d0
bsr point ;color at 31-x,y
move d3,d5
move d4,d2
bsr setcolor ;first color
bsr plot0 ; plot at 31-x,y
eor #31,d0
move d5,d2
bsr setcolor ;second color
bsr plot0 ; plot at x,y
dbf d0,mirx ;next x
dbf d1,miry ;next y
bsr getimg ;update image
bra exit
*
* Up & Down
updown move #31,d0 ;x=31 to 0
updox move #15,d1 ;y=15 to 0
updoy bsr point ;color at x,y
move d3,d4
eor #31,d1
bsr point ;color at x,31-y
move d3,d5
move d4,d2
bsr setcolor ;first color
bsr plot0 ; plot at x,31-y
eor #31,d1
move d5,d2
bsr setcolor ;second color
bsr plot0 ; plot at x,y
dbf d1,updoy
dbf d0,updox
bsr getimg ;update image
bra exit
*
* Turn 90'
turn90 clr d1
t90y clr d0
t90x bsr point
move d3,d4
move d0,d7
move d1,d0
move d7,d1
eor #31,d0
bsr point
move d3,d2
eor #31,d0
move d0,d7
move d1,d0
move d7,d1
bsr setcolor
bsr plot0
eor #31,d0
eor #31,d1
bsr point
move d3,d2
move d0,d7
move d1,d0
move d7,d1
eor #31,d1
bsr setcolor
bsr plot0
eor #31,d0
eor #31,d1
bsr point
move d3,d2
move d0,d7
move d1,d0
move d7,d1
eor #31,d1
bsr setcolor
bsr plot0
move d0,d7
move d1,d0
move d7,d1
eor #31,d0
move d4,d2
bsr setcolor
bsr plot0
move d0,d7
move d1,d0
move d7,d1
eor #31,d0
addq #1,d0
cmp #16,d0
bne t90x
addq #1,d1
cmp #16,d1
bne t90y
bsr getimg ;update image
bra exit
*
* Turn 270'
turn270 clr d1
t270y clr d0
t270x bsr point
move d3,d4
move d0,d7
move d1,d0
move d7,d1
eor #31,d1
bsr point
move d3,d2
move d0,d7
move d1,d0
move d7,d1
eor #31,d0
bsr setcolor
bsr plot0
eor #31,d0
eor #31,d1
bsr point
move d3,d2
eor #31,d1
move d0,d7
move d1,d0
move d7,d1
bsr setcolor
bsr plot0
eor #31,d0
eor #31,d1
bsr point
move d3,d2
eor #31,d1
move d0,d7
move d1,d0
move d7,d1
bsr setcolor
bsr plot0
eor #31,d0
move d0,d7
move d1,d0
move d7,d1
move d4,d2
bsr setcolor
bsr plot0
eor #31,d0
move d0,d7
move d1,d0
move d7,d1
addq #1,d0
cmp #16,d0
bne t270x
addq #1,d1
cmp #16,d1
bne t270y
bsr getimg ;update image
bra exit
*
* Clear
clear clr d2
bsr setcolor
move #31,d1 ;y=31 to 0
clry move #31,d0 ;x=31 to 0
clrx bsr plot0 ;clear
dbf d0,clrx
dbf d1,clry
bsr getimg ;update image
bra exit
*
* Put image (move image from memory to big board)
putimg move #9,d1
move.l imgptr(a3),a0 ;address to 16 images
clr d0
move.b img1(a3),d0 ;image to be putted
lsl d1,d0 ;each image 512 bytes
lea 0(a0,d0.w),a0 ;address to current image
move.l scr1(a3),a1 ;physbase
add.l #23168,a1 ;pos 256,144
move #31,d0 ;32 lines
putl move.l (a0)+,(a1)+ ;copy from memory to screen
move.l (a0)+,(a1)+
move.l (a0)+,(a1)+
move.l (a0)+,(a1)+
add.l #144,a1 ;next line
dbf d0,putl
move #31,d0 ;x=31 to 0
putlx move #31,d1 ;y=31 to 0
putly bsr point ;get color value to d3 (from little board)
move d3,d2
bsr setcolor
bsr plot0 ;plot on big board (& little board)
dbf d1,putly
dbf d0,putlx
bra exit
*
* Copy physbase to background
copy1 move.l scr1(a3),a0 ;physbase
move.l scr2(a3),a1 ;background
move #8000,d0 ;8000 long words
copy move.l (a0)+,(a1)+ ;copy
dbf d0,copy
bra exit
*
* Copy background to physbase
copy2 move.l scr2(a3),a0
move.l scr1(a3),a1
move #8000,d0
bra copy
*
* Copy images img1 to img2
copyimg move #9,d1
move.l imgptr(a3),a0 :\start of image area
clr d0
move.b img1(a3),d0
lsl d1,d0 :\each image 512 bytes
add.l d0,a0 :\ptr to image 1
move.l imgptr(a3),a1
clr d0
move.b img2(a3),d0
lsl d1,d0
add.l d0,a1 :\ptr to image 2
move #31,d0 :\32 lines
copyl move.l (a0)+,(a1)+
move.l (a0)+,(a1)+
move.l (a0)+,(a1)+
move.l (a0)+,(a1)+
dbf d0,copyl
bra exit
*
* Swap images
swapimg move #9,d1
move.l imgptr(a3),a0 :\start of image area
clr d0
move.b img1(a3),d0
lsl d1,d0 :\each image 512 bytes
add.l d0,a0 :\ptr to image 1
move.l imgptr(a3),a1
clr d0
move.b img2(a3),d0
lsl d1,d0
add.l d0,a1 :\ptr to image 2
move #31,d0 :\32 lines
swapl move.l 0(a0),d1
move.l 4(a0),d2
move.l 8(a0),d3
move.l 12(a0),d4
move.l 0(a1),(a0)+
move.l 4(a1),(a0)+
move.l 8(a1),(a0)+
move.l 12(a1),(a0)+
move.l d1,(a1)+
move.l d2,(a1)+
move.l d3,(a1)+
move.l d4,(a1)+
dbf d0,swapl
bra exit
*
* Show sprite
showspr bsr dospr
bra exit
*
* Move sprite
movespr bsr unspr
bsr dospr
bra exit
*
* Hide sprite
hidespr bsr unspr
bra exit
*
* Erase sprite (used by program)
unspr lea local(pc),a2
move.l sproff(a2),d0 :\offset to screen
move.l scr1(a3),a0 :\physbase
move.l scr2(a3),a1 :\background
add.l d0,a0
add.l d0,a1
move sprheight(a2),d1 :\visible sprite height-1
move sprwidth(a2),d0 :\x-words saved
cmp #1,d0 :\16 pixel saved?
beq un16
cmp #2,d0 :\32 pixel saved?
beq un32 :\ else 48 pixel saved!
un48 move.l (a1)+,(a0)+ :\copy 48 pixel*4 planes=24 bytes
move.l (a1)+,(a0)+
move.l (a1)+,(a0)+
move.l (a1)+,(a0)+
move.l (a1)+,(a0)+
move.l (a1)+,(a0)+
add.l #136,a0 :\next line
add.l #136,a1
dbf d1,un48
rts
un32 move.l (a1)+,(a0)+ :\copy 32 pixel*4 planes=16 bytes
move.l (a1)+,(a0)+
move.l (a1)+,(a0)+
move.l (a1)+,(a0)+
add.l #144,a0 :\next line
add.l #144,a1
dbf d1,un32
rts
un16 move.l (a1)+,(a0)+ :\copy 16pixel*4 planes=8 bytes
move.l (a1)+,(a0)+
add.l #152,a0 :\next line
add.l #152,a1
dbf d1,un16
rts
*
* Draw sprite (used by program)
dospr lea local(pc),a2
move #9,d1
move.l imgptr(a3),a1
clr d0
move.b sprimg(a3),d0
lsl d1,d0
add.l d0,a1 :\image pointer
move sprx(a3),d0 :\sprite-x
move spry(a3),d1 :\sprite-y
cmp #350,d0 :\x out of range? (0-350)
bhi doexit
cmp #230,d1 :\y out of range? (0-230)
bhi doexit
*
move.l #0,a0 :\offset on screen (inc. later)
*
cmp #30,d1 :\sprite at top?
bhi donotop
move d1,d2 :\#lines-1=y0
eor #31,d1 :\start=31-y0
bra doyok
donotop cmp #199,d1 :\sprite in middle?
bhi donomiddle
move d1,d7 :\screen=y0-31
sub #31,d7
mulu #160,d7
add.w d7,a0 :\inc. screen offset
clr d1 :\start=0
move #31,d2 :\#lines-1=31
bra doyok
donomiddle move d1,d7 :\screen=y0-31
sub #31,d7
mulu #160,d7
add.w d7,a0 :\inc. screen offset
move d1,d2 :\#lines-1=31-(y0-199)
sub #199,d2
eor #31,d2
clr d1 :\start=0
doyok move d2,sprheight(a2) :\save height-1
lsl #4,d1 :\adjust image ptr
lea 0(a1,d1.w),a1 :\ to current sprite height
cmp #14,d0 :\sprite on left side?
bhi nol1
*Sprite on the left side (0-50%)
move #1,sprwidth(a2) :\save x-words (16 pixel)
move.l a0,sproff(a2) :\save screen offset
add.l scr1(a3),a0 :\physbase+offset
and #15,d0 :\x MOD 15=rotations
addq #1,d0 :\at least one pixel visible
addq.l #8,a1 :\skip left side of sprite
dloop1 bsr pixleft
add.l #160,a0 :\next line
add.l #8,a1 :\skip left side
dbf d2,dloop1
bra doexit
nol1 cmp #30,d0 :\sprite on left side?
bhi nol2
*Sprite on the left side (50-100%)
move #2,sprwidth(a2) :\save x-words (32 pixel)
move.l a0,sproff(a2) :\save screen offset
add.l scr1(a3),a0 :\physbase+offset
sub #15,d0 :\begin x=0
and #15,d0 :\rotations
dloop2 bsr pixleft
bsr pix16
add.l #160,a0 :\next line
dbf d2,dloop2
bra doexit
nol2 cmp #319,d0 :\sprite in the middle (x)
bhi nocenter
*Sprite in the middle
move #3,sprwidth(a2) :\save x-words (48 pixel)
sub #31,d0 :\begin x=0
move d0,d3
and #15,d0 :\rotations
lsr #4,d3 :\x-byte=4*(x DIV 16)
lsl #3,d3
lea 0(a0,d3.w),a0 :\inc. screen offset
move.l a0,sproff(a2) :\save screen offset
add.l scr1(a3),a0 :\physbase+offset
dloop3 bsr pix16
add.l #8,a0 :\next 16 pixel
bsr pix16
add.l #152,a0 :\next line
dbf d2,dloop3
bra doexit
nocenter cmp #335,d0 :\sprite on right side?
bhi doright2
*Sprite on the right side (50-100%)
move #2,sprwidth(a2) :\save x-words (32 pixel)
add.l #144,a0 :\inc. screen offset
move.l a0,sproff(a2) :\save screen offset
add.l scr1(a3),a0 :\physbase+offset
sub #320,d0 :\begin x=0
and #15,d0 :\rotations
addq #1,d0 :\at least one pixel visible
dloop4 bsr pix16
add.l #8,a0 :\next 16 pixel
bsr pixright
add.l #152,a0 :\next line
dbf d2,dloop4
bra doexit
*Sprite on the right side (0-50%)
doright2 move #1,sprwidth(a2) :\save x-words (16 pixel)
add.l #152,a0 :\inc. screen offset
move.l a0,sproff(a2) :\save screen offset
add.l scr1(a3),a0 :\phybase+offset
sub #336,d0 :\begin x=0
and #15,d0 :\rotations
addq #1,d0 :\at least one pixel visible
dloop5 bsr pixright
add.l #8,a1 :\skip right side on sprite
add.l #160,a0 :\next line
dbf d2,dloop5
doexit rts
*
pix16 MOVE (A1)+,D4 :\get sprite data
MOVE (A1)+,D5 :\4planes a 16 pixel
MOVE (A1)+,D6
MOVE (A1)+,D7
SWAP D4 :\sprite in high word
SWAP D5
SWAP D6
SWAP D7
CLR D4 :\clear low word
CLR D5
CLR D6
CLR D7
LSR.L D0,D4 :\rotate D0 times
LSR.L D0,D5
LSR.L D0,D6
LSR.L D0,D7
*make a mask (color 0=transparent)
MOVE.L D4,D3
OR.L D5,D3
OR.L D6,D3
OR.L D7,D3
*mask sprite data
AND.L D3,D4
AND.L D3,D5
AND.L D3,D6
AND.L D3,D7
*mask screen
NOT.L D3
AND D3,$8(A0)
AND D3,$A(A0)
AND D3,$C(A0)
AND D3,$E(A0)
SWAP D3
AND D3,$0(A0)
AND D3,$2(A0)
AND D3,$4(A0)
AND D3,$6(A0)
SWAP D3
*add screen with sprite
ADD D4,$8(A0)
ADD D5,$A(A0)
ADD D6,$C(A0)
ADD D7,$E(A0)
SWAP D4
SWAP D5
SWAP D6
SWAP D7
ADD D4,$0(A0)
ADD D5,$2(A0)
ADD D6,$4(A0)
ADD D7,$6(A0)
rts
*
pixleft MOVE (A1)+,D4 :\get sprite data
MOVE (A1)+,D5 :\4planes a 16 pixel
MOVE (A1)+,D6
MOVE (A1)+,D7
SWAP D4 :\sprite in high word
SWAP D5
SWAP D6
SWAP D7
CLR D4 :\clear low word
CLR D5
CLR D6
CLR D7
LSR.L D0,D4 :\rotate D0 times
LSR.L D0,D5
LSR.L D0,D6
LSR.L D0,D7
*make a mask (color 0=transparent)
MOVE D4,D3
OR D5,D3
OR D6,D3
OR D7,D3
*mask sprite data(uses only bit0-15)
AND D3,D4
AND D3,D5
AND D3,D6
AND D3,D7
*mask screen
NOT D3
AND D3,$0(A0)
AND D3,$2(A0)
AND D3,$4(A0)
AND D3,$6(A0)
*add screen with sprite
ADD D4,$0(A0)
ADD D5,$2(A0)
ADD D6,$4(A0)
ADD D7,$6(A0)
rts
*
pixright MOVE (A1)+,D4 :\get sprite data
MOVE (A1)+,D5 :\4planes a 16 pixel
MOVE (A1)+,D6
MOVE (A1)+,D7
SWAP D4 :\sprite in high word
SWAP D5
SWAP D6
SWAP D7
LSR.L D0,D4 :\rotate D0 times
LSR.L D0,D5
LSR.L D0,D6
LSR.L D0,D7
SWAP D4 :\sprite in low word
SWAP D5
SWAP D6
SWAP D7
*make a mask (color 0=transparent)
MOVE D4,D3
OR D5,D3
OR D6,D3
OR D7,D3
*mask sprite data
AND D3,D4
AND D3,D5
AND D3,D6
AND D3,D7
*mask screen
NOT D3
AND D3,$0(A0)
AND D3,$2(A0)
AND D3,$4(A0)
AND D3,$6(A0)
*add screen with sprite
ADD D4,$0(A0)
ADD D5,$2(A0)
ADD D6,$4(A0)
ADD D7,$6(A0)
rts
*
fillpatt dc.w $ffff,$ffff
local ds.w 30
dx equ 0
dy equ 2
sdx equ 4
sdy equ 6
adx equ 8
ady equ 10
sproff equ 12
sprwidth equ 16
sprheight equ 18
*
end